Release 10.1A: OpenEdge Development:
Progress 4GL Handbook
The 4GL combines procedural, database, and user interface statements
There are three basic kinds of statements in a 4GL program: procedural statements, database access statements, and user interface statements. Sometimes individual statements contain elements of all three. Your first simple procedure contains all three types, and illustrates the power of the language.
The
FOR EACHstatement itself can be considered procedural, because it defines an action within the program, in this case, repeating a block of statements up to theENDstatement.But the
FOR EACHstatement is also a database access statement, because it defines a result set that theFOR EACHblock is going to iterate over, in this case, the set of all Customer records in the database. This simple convention of combining procedural logic with database access is a fundamental and enormously powerful feature of the Progress 4GL. In another language, you would have to define a database query using a syntax that is basically divorced from the procedural language around it, and then have additional statements to control the flow of data into your procedure. In the 4GL, you can combine all these elements in a way that is very natural, flexible, and efficient, and relates to the way you think about how the program uses the data.The
FOR EACHblock is also powerful because it transparently presents each record to your program in turn, so that the rest of the procedural logic can act on it. If you’ve written applications that use the SQL language for data retrieval, you can compare the ProgressFOR EACHblock with a program in another language containing embedded SQL statements, where the set-based nature of theSQL SELECTstatement is not a good match to the record-by-record way in which your program normally wants to interact with the data.The
DISPLAYstatement shows that user interface statements are also closely integrated with the rest of the program. Progress contains language statements not only to display data, but also to create, update, and delete records, and to assign individual values. All of these statements are fully integrated with the procedural language. In later chapters, you’ll learn how to build your applications so that the procedures that control the user interface are cleanly separated from the procedures that manage the data and define your business logic.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |